#ifndef __BSP_CAN_H
#define __BSP_CAN_H

#include "gd32f4xx_gpio.h"
#include "gd32f4xx_can.h"
#include <stdint.h>   
#include "ringbuffer.h"

typedef struct 
{
    ring_buffer r_buff;  // 接收或者发送缓存
    ring_buffer t_buff;  // 接收或者发送缓存
    uint8_t r_sem;  // 表示接收或者发送完成信号
    uint8_t t_sem;  // 表示接收或者发送完成信号
}bsp_can_com_t;

extern bsp_can_com_t can_com;
extern void bsp_can0_init(void);
extern void bsp_can0_write_bytes(uint8_t can_id, uint8_t *data, uint8_t len);
extern uint8_t bsp_can0_read_bytes(uint8_t* data, uint8_t len);

#endif
